#include "ACUAS/ACUAS.h"
#include "ACUAS/ACUASlcd.h"

PROGRAM_INIT

float x,y,z,Grades;

//DDRC = 0b11111111; // Output data direction: LEDs at Port C
//	DDRA = 0b00000000;
//	PORTA= 0b11111111;

	ACTIVATE_LCD;
	LCD_XY(1,1);
	LCD_TEXT("Accelerometer");
	LCD_XY(4,2);
	LCD_TEXT("Beginwithjoystick");
	x=340;
	y=255.3;
	z=337.92;

PROGRAM_START

			LCD_XY(1,1) LCD_TEXT("                ");//Clean the LCD
			LCD_XY(1,2) LCD_TEXT("                ");//Clean the LCD


	while (x<=z & y<z)
 			{Grades=((((y*5)/1024)-0.85)*112);
				LCD_XY(1,1) LCD_NUMBER("Grades");
				LCD_XY(1,1) LCD_TEXT("      ");
			}



	while (x<=z & y>=z)
 			{Grades=((((y*5)/1024)-0.85)*112);
			     LCD_XY(1,1) LCD_NUMBER("Grades");
				 LCD_XY(1,1) LCD_TEXT("      ");
			}

	while (x>=z & y>=z)
 			{Grades=((((y*5)/1024)-2.45)*(-113.7)+180);
			     LCD_XY(1,1) LCD_NUMBER("Grades");
				 LCD_XY(1,1) LCD_TEXT("      ");
			}
	while (x>=z & y<=z)
 			{Grades=((((y*5)/1024)-1.65)*(-113.7)+180);
                 LCD_XY(1,1) LCD_NUMBER("Grades");
			     LCD_XY(1,1) LCD_TEXT("      ");
			}

PROGRAM_END
